package com.jie.jie.Fanshe;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.jaydenxiao.common.commonutils.LogUtils;

import java.lang.reflect.Field;

/**
 * Created by Administrator on 2017/4/17.
 */

public abstract class BaseActy extends AppCompatActivity {
    public void get(Context context) {
        Class<? extends BaseActy> aClass = (Class<? extends BaseActy>) context.getClass();
        try {
            BaseActy baseActy = aClass.newInstance();
            Field[] declaredFields = aClass.getDeclaredFields();
            for (Field field : declaredFields) {
                field.setAccessible(true);
                field.get(context);
                Log.e("tag", "get: "+field.getName()+"     "+field.get(context) );
                if (field.getType().toString().equals("int")) {
                    LogUtils.loge("sss");
                }
            }
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onStop() {
        super.onStop();
        LogUtils.loge("onstop");
       new ReflectUtils().sava(this);
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        LogUtils.loge("onrestart");
        new ReflectUtils().readFromAcach(this);
    }
}
